import { useKoa } from "@/hooks"
/**上传接口 */
import uploadRouters from "./routers/upload"
/**状态查看接口 */
import statusRouters from "./routers/status"
/**webHook */
import pushRouters from "./routers/push"

import { getMasterIp } from "@/utils"

import chalk from "chalk"

const { mountRouter, app } = useKoa()

mountRouter([uploadRouters, statusRouters, pushRouters])

const PORT = 7008

app.listen(PORT, () => {
  const masterIp = getMasterIp()

  console.log(
    chalk.green("Server started successfully:"),
    chalk.blue(`http://${masterIp}:${PORT}`),
  )
})
